﻿<UserControl x:Class="SoftTeach.View.Curricula.CurriculumWorkspaceView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:curriculumView="clr-namespace:SoftTeach.View.Curricula"
             xmlns:curricula="clr-namespace:SoftTeach.ViewModel.Curricula"
             xmlns:softTeach="clr-namespace:SoftTeach"
             mc:Ignorable="d" 
             d:DesignHeight="400" d:DesignWidth="800">
  <Grid>
    <Grid.ColumnDefinitions>
      <ColumnDefinition Width="300"/>
      <ColumnDefinition/>
    </Grid.ColumnDefinitions>
    <Grid Grid.Column="0">
      <Grid Grid.Row="1">
        <Grid.RowDefinitions>
          <RowDefinition Height="Auto"/>
          <RowDefinition Height="Auto"/>
          <RowDefinition Height="*"/>
        </Grid.RowDefinitions>
        <StackPanel Grid.Row="0" Orientation="Horizontal">
          <Button Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}" Command="{Binding Path=AddCurriculumCommand}" ToolTip="Neuen Curriculum erstellen">
            <StackPanel Orientation="Horizontal">
              <Grid>
                <Image Source="/SoftTeach;component/Images/Curriculum32.png"/>
                <Image Source="/SoftTeach;component/Images/AddOverlay32.png"/>
              </Grid>
              <!--<Label Padding="5,0,0,0" VerticalContentAlignment="Center">Neues Curriculum erstellen</Label>-->
            </StackPanel>
          </Button>
          <Button Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}" Command="{Binding Path=DeleteCurriculumCommand}" ToolTip="Curriculum löschen" >
            <StackPanel Orientation="Horizontal">
              <Grid>
                <Image Source="/SoftTeach;component/Images/Curriculum32.png" />
                <Image Source="/SoftTeach;component/Images/RemoveOverlay32.png"/>
              </Grid>
              <!--<Label Padding="5,0,0,0" VerticalContentAlignment="Center">Dieses Curriculum löschen</Label>-->
            </StackPanel>
          </Button>
          <Button Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}" Command="{Binding Path=CopyCurriculumCommand}" ToolTip="Curriculum kopieren" >
            <StackPanel Orientation="Horizontal">
              <Grid>
                <Image Source="/SoftTeach;component/Images/Curriculum32.png" />
                <Image Source="/SoftTeach;component/Images/CopyOverlay32.png"/>
              </Grid>
            </StackPanel>
          </Button>
        </StackPanel>
        <GroupBox Grid.Row="1" Header="Filtern" Margin="4,0,4,0">
          <Grid>
            <Grid.RowDefinitions>
              <RowDefinition/>
              <RowDefinition/>
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
              <ColumnDefinition Width="60"/>
              <ColumnDefinition/>
              <ColumnDefinition Width="Auto"/>
            </Grid.ColumnDefinitions>
            <Label Grid.Row="0" Grid.Column="0" Padding="3" VerticalAlignment="Center">Schuljahr</Label>
            <ComboBox Grid.Row="0" Grid.Column="1" ItemsSource="{Binding Source={x:Static softTeach:App.MainViewModel}, Path=Jahrtypen}"
                              SelectedValue="{Binding Path=JahrtypFilter}" 
                              SelectedValuePath="." 
                              DisplayMemberPath="JahrtypBezeichnung"
                        Style="{StaticResource {x:Static ToolBar.ComboBoxStyleKey}}"
                      HorizontalAlignment="Stretch"/>
            <Button Grid.Row="0" Grid.Column="2" Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}"
                Command="{Binding Path=ResetJahrtypFilterCommand}">
              <Image Source="/SoftTeach;component/Images/Remove16.png"/>
            </Button>
            <Label Grid.Row="1" Grid.Column="0" Padding="3" VerticalAlignment="Center">Fach</Label>
            <ComboBox Grid.Row="1" Grid.Column="1" MinWidth="100" ItemsSource="{Binding Source={x:Static softTeach:App.MainViewModel}, Path=Fächer}"
                              SelectedValue="{Binding Path=FachFilter}" 
                              SelectedValuePath="." 
                              DisplayMemberPath="FachBezeichnung"
                        Style="{StaticResource {x:Static ToolBar.ComboBoxStyleKey}}"
                                          HorizontalAlignment="Stretch"/>
            <Button Grid.Row="1" Grid.Column="2" Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}"
                Command="{Binding Path=ResetFachFilterCommand}">
              <Image Source="/SoftTeach;component/Images/Remove16.png"/>
            </Button>
          </Grid>
        </GroupBox>
        <DataGrid Grid.Row="2" Margin="5" SelectedItem="{Binding Path=CurrentCurriculum, Mode=TwoWay}" 
                  ItemsSource="{Binding Path=CurriculaView}" AutoGenerateColumns="False">
          <DataGrid.Columns>
            <DataGridTextColumn Header="Fach" Binding="{Binding Path=CurriculumFach.FachKurzbezeichnung}" Width="Auto"
                                  SortMemberPath="CurriculumFach.FachBezeichnung" IsReadOnly="True"/>
            <DataGridTextColumn Header="Schuljahr" Binding="{Binding Path=CurriculumJahrtyp.JahrtypKurzbezeichnung}"
                                  Width="Auto" SortMemberPath="CurriculumJahrtyp.JahrtypBezeichnung" IsReadOnly="True"/>
            <DataGridComboBoxColumn 
                        Header="Halbjahr" 
                        ItemsSource="{Binding Source={x:Static softTeach:App.MainViewModel}, Path=Halbjahrtypen}"
                        SelectedItemBinding="{Binding Path=CurriculumHalbjahrtyp}" 
                        DisplayMemberPath="HalbjahrtypBezeichnung" SortMemberPath="CurriculumHalbjahrtyp.HalbjahrtypBezeichnung"
                        EditingElementStyle="{StaticResource DatagridComboBoxElementStyle}"/>
            <DataGridTextColumn Header="Klasse" Binding="{Binding Path=CurriculumKlassenstufe.KlassenstufeBezeichnung}"
                                  SortMemberPath="CurriculumKlassenstufe.KlassenstufeBezeichnung" Width="Auto" IsReadOnly="True"/>
            <DataGridTextColumn Header="Bezeichnung" Binding="{Binding Path=CurriculumBezeichnung}" 
                                  SortMemberPath="CurriculumBezeichnung" Width="*"/>
          </DataGrid.Columns>
        </DataGrid>
      </Grid>
    </Grid>
    <ContentControl Grid.Column="1" Content="{Binding Path=CurrentCurriculum}">
      <ContentControl.Resources>
        <DataTemplate DataType="{x:Type curricula:CurriculumViewModel}">
          <curriculumView:CurriculumDetailView />
        </DataTemplate>
      </ContentControl.Resources>
    </ContentControl>
  </Grid>
</UserControl>
